# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=python-rapidjson
pkgver=1.10
pkgrel=2
pkgdesc="Python wrapper around rapidjson"
arch=('loong64' 'x86_64')
url="https://pypi.python.org/pypi/python-rapidjson"
license=('MIT')
depends=('python')
makedepends=('python-setuptools' 'rapidjson')
checkdepends=('python-pytest-runner' 'python-pytest-benchmark' 'python-pytz')
source=("https://pypi.io/packages/source/p/python-rapidjson/python-rapidjson-$pkgver.tar.gz")
sha512sums=('bbb20884051c225d83e1b0494d40db8c6f548eb4fd3db8f217bfd9be9f14fb108d20d51c7a0a20e8b00bb085fb0328dc7b47029ee9a19e8e16e4dc0ae0dec889')

prepare() {
  #rm -r python-rapidjson-$pkgver/rapidjson
  #sed -i 's/if not os.path.isdir/if os.path.isdir/' python-rapidjson-$pkgver/setup.py
  # Shared rapidjson fails tests.
  :
}

build() {
  cd python-rapidjson-$pkgver
  python setup.py build # --rj-include-dir=/usr/include
}

check() {
  cd python-rapidjson-$pkgver
  python setup.py pytest --addopts '--ignore benchmarks/'
}

package() {
  cd python-rapidjson-$pkgver
  python setup.py install -O1 --root="$pkgdir"
  install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname/
}
